<?php
$n=$_GET['nickname'];
$p=$_GET['password'];

//连接数据库
$link=mysqli_connect("localhost",'root','','shop');
//设置编码
mysqli_set_charset($link,"utf8");
//SQL语句
$sql="select * from user where name='$n' and password='$p'";
//执行SQL语句
$result=mysqli_query($link,$sql);
//判断结果集中是否存在数据
if($row=mysqli_fetch_assoc($result)){
    echo "<script>
    sessionStorage.name='".$n."';
    sessionStorage.state='登录成功';
    location='../html/status.html';
    </script>";
}else{
    echo "<script>
    sessionStorage.state='登录失败，密码或者账号错误';
    location='../html/status.html';
    </script>";
}

//关闭数据库连接
mysqli_close($link);
?>